package com.example.springboot.aspect;

import com.example.springboot.annotation.Slf4jAnnotation;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 切面类
 * @Author:wzf
 * @Data:2022/2/21
 * @Version:1.0
 */
@Component
@Aspect
public class Slf4jAnnotationAspect {


  @Pointcut("@annotation(com.example.springboot.annotation.Slf4jAnnotation)")
  private  void pointCut(){

  }

  @Before("pointCut() && @annotation(logger)")
  public void advice(Slf4jAnnotation logger){
    System.out.println("这是--自定的一个注解打印出来的:" + logger.value());
  }
}
